package networkInterface;

import main.ChatSystem;


/**
 * Abstract receiving class
 * 
 * <p>
 * <ul>
 * <li>Project: 	ChatSystemG3</li>
 * <li>Called by: 	ChatNI</li>
 * </ul>
 * </p>
 * 
 * @author COMBES Nicolas - LECHANTRE Arnaud
 * @see Runnable
 */
public abstract class ChatNIReceiver implements Runnable{
	
	
	/**
	 * Boolean indicating if the user asked to close the socket (disconnect)
	 */
	private boolean hasToClose;			
	
	
	/**
	 * Construct
	 * @param chatNI : controller of the application
	 */
	public ChatNIReceiver(FromNetwork chatNI) {
		super();
		this.hasToClose=false;
	}


	/**
	 * 
	 * @return this.hasToClose
	 */
	public boolean hasToClose() {
		return hasToClose;
	}

	/**
	 * Sets this.hasToClose
	 * @param hasToClose
	 */
	public void setHasToClose(boolean hasToClose) {
		this.hasToClose = hasToClose;
	}

	
	/**
	 * cleanly ends the thread execution
	 */
	public void close() {
		this.hasToClose = true;
		if(ChatSystem.debugMode)System.out.println("networkInterface.ChatNIReceiver : Reception socket closing");
		
	}
	
	
}
